package com.shop.util;

import org.springframework.util.StringUtils;

public class ResultGenerator {
    private static final int RESULT_CODE_SUCCESS = 20000;
    private static final int RESULT_CODE_SERVER_ERROR = 500;

    public static Result genSuccessResult() {
        Result result = new Result();
        result.setStatus(RESULT_CODE_SUCCESS);
        return result;
    }



    public static Result genSuccessResult(Object data) {
        Result result = new Result();
        result.setStatus(RESULT_CODE_SUCCESS);
        result.setData(data);
        return result;
    }

    public static Result genFailResult(int status) {
        Result result = new Result();
        result.setStatus(status);
        return result;
    }
    public static Result genFailResult(int status,Object data) {
        Result result = new Result();
        result.setStatus(status);
        result.setData(data);
        return result;
    }

}
